package com.zzyl.controller.customer;

import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.dto.WechatLoginDto;
import com.zzyl.service.CustomerLoginService;
import com.zzyl.vo.LoginVo;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/customer")
@Slf4j
@Api("微信登录")
public class CustomerLoginController extends BaseController {
    @Autowired
    private CustomerLoginService customerLoginService;

    /**
     * 微信小程序登录
     * @param wechatLoginDto
     * @return
     */
    @PostMapping("/user/login")
    public ResponseResult<LoginVo> login(@RequestBody WechatLoginDto wechatLoginDto) {
        LoginVo vo = customerLoginService.login(wechatLoginDto);
        return ResponseResult.success(vo);
    }
}
